﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.Unity.InterceptionExtension;

namespace Kugar.Core.Security.Permission
{
    public class PermissionCheckedEventArgs : EventArgs
    {
        public PermissionCheckedEventArgs(string userID, PermissionInfoAttribute permissionInfo, NoPermissionException error)
        {
            Error = error;
            PermissionInfo = permissionInfo;
            UserID = userID;
        }

        public string UserID { set; get; }

        public Exception Error { protected set; get; }

        public PermissionInfoAttribute PermissionInfo { protected set; get; }

        public bool HasError
        {
            get
            {
                return Error != null;
            }
        }

        public bool IsRetryCheck { set; get; }

        public int CheckTimes { set; get; }
    }

    public class PermissionBeginInvokeEventArgs : EventArgs
    {
        public IParameterCollection Params { set; get; }
    }

    public class PermissionEndInvokeEventArgs : EventArgs
    {
        public object ReturnValue { set; get; }

        public Exception Error { set; get; }

        public IParameterCollection Outputs { set; get; }
    }
}
